
# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        Young  
# Name:         task8_4_1_1
# Description:
# Author:       $赵怡蕾
# Date:         2019/3/20
#-------------------------------------------------------------------------------

'''作业 三个类,有一个是人基类,老师,学生继承自人,老师去教工食堂吃饭,住在家里或教工宿舍,学生去
普通食堂吃饭,住学生宿舍,老师讲课,学生上课,共有属性姓名,年龄,性别,身高,体重,定义共有方法和特有方法
各三个,特有属性定义一个以上'''

class Person:
    def __init__(self, name,age,sex,height,weight):
        self.name = name
        self.age = age
        self.sex = sex
        self.height = height
        self.weight = weight

    def getName(self):
        return "我是中国人"

    def greet(self):
        return "我的愿望是世界和平"


class Teacher(Person):
    def pay(self):
        return "100000"
    def eat(self):
        return "我在教工食堂吃饭"

    def sleep(self):
        return "我住在家里"

    def outName(self):
        print("我叫{}是一名教师,今年{}岁,性别{},有{}cm,{}kg,我的薪资是{}元".format(t.name,t.age,t.sex,t.height,t.weight,t.pay))


class Student(Person):
    def __init__(self,name,age,sex,height,weight,school):
        super().__init__( name,age,sex,height,weight)
        self.school = school

    def eats(self):
        return "我在食堂吃饭"

    def sleeps(self):
        return "我住在学生公寓"

    def getinfo(self):
        return "我叫{},今年{}岁,性别{},有{}cm,{}kg,来自{}".format(s.name,s.age,s.sex,s.height,s.weight,s.school)


if __name__ == '__main__':
    t = Teacher("张三",45,"男",180,70)
    t.pay = '100000'
    print(t.outName(),t.eat(),t.sleep(),t.getName(),t.greet())
    s = Student("李四",18,"女",160,47,"湖南工业大学")
    print(s.getinfo(),s.eats(),s.sleeps(),s.getName(),s.greet())
